const TIME = {
  "分": increaseNum(1, 59),
  "时":increaseNum(1,23),
  // "日期":increaseNum(1,31),
  // "月份": increaseNum(1, 12)
}
function increaseNum(s,e) {
  let arr = [];
  for (let i = s; i<=e; i++) {
    arr.push(i)
  }
  return arr;
} 

//迭代四选周期间隔timeTYpe传"", 特殊处理CORN时间格式
export function translateTimeFromCRON(timeStr, timeType) {
  let timeArr = timeStr.split(" ");
  const seconds = timeArr[0]
  const minutes = timeArr[1]
  const hour = timeArr[2]
  const date = timeArr[3]
  const month = timeArr[4]
  let periodObj = {
    type: '',
    value: ''
  };
  timeArr.forEach((item, index) => {
    if(item.indexOf("/") > -1) {
      let timeIndex = index;
      let time = item.substring(2);
      switch(index) {
        case 1:
          periodObj.type = '分';
          periodObj.value = time
          break;
        case 2:
          periodObj.type = '时';
          periodObj.value = time
          break;
        case 3:
          periodObj.type = '日期';
          periodObj.value = time
          break;
        case 4:
          periodObj.type = '月';
          periodObj.value = time
          break;
        default:
          break;
      }          
    }
  })
  return periodObj;
}

export default TIME;